package com.loser.rpc.search.rpc;

import com.loser.module.base.common.ApiResponse;
import com.loser.module.base.proto.sdk.cmd.ServiceNames;
import com.loser.rpc.search.dto.req.OptLogReq;
import com.loser.rpc.search.dto.resp.OptLogResp;
import com.loser.rpc.search.fallback.SearchFeignFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(value = ServiceNames.SEARCH, fallback = SearchFeignFallBack.class)
@Component
public interface SearchFeign {

    @PostMapping("/search/save")
    ApiResponse<Boolean> save(@RequestBody OptLogReq req);

    @GetMapping("/search/list/{userId}")
    ApiResponse<List<OptLogResp>> getList(@PathVariable("userId") Long userId);

}
